package cn.pinming.suite;


import cn.pinming.pmsuite.utils.DateUtils;
import io.modelcontextprotocol.autoconfigure.definition.Tool;
import io.modelcontextprotocol.autoconfigure.definition.ToolParam;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Service
public class WeatherService {


    /**
     * 获取天气，测试但字符串返货
     * @param state 状态
     * @return 字符串
     */
    @Tool(description = "test mcp")
    public String getWeather(
            @ToolParam(description = "参数描述") String state
    ) {
        return "当前天气：晴，温提：22度，比较适合外出旅游"+state;
    }


    /***
     * 测试多个参数
     * @param question 问题
     * @param state 状态
     * @return 返回map对象
     */
    @Tool(description = "test_multi_arg")
    public Map<String,Object> test_multi_arg(
            @ToolParam(description = "输入参数1") String question,
            @ToolParam(description = "输入参数2,非必填",required = false) Integer state
    ) {
        Map<String,Object> map = new HashMap<>();
        map.put("question", question);
        map.put("now", DateUtils.now());
        map.put("state", state);
        return map;
    }
}
